<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});
//多请求路由
/*Route::match(['get','post'],'multy',function (){
    return 'multy';
});
Route::any('any',function (){
    return 'any';
});*/
//路由参数
/*Route::get('user/{id}',function ($id){
    return 'user-id-'.$id;
})->where('id','[0-9]+');
Route::get('user/{name?}',function ($name = 'sean'){
    return 'user-name-'.$name;
})->where('name','[A-Za-z]+');*/
/*
Route::prefix('admin')->group(function () {
    Route::get('{id?}/{name?}',function ($id='12',$name = 'sean'){
        return 'user-name-'.$name.'-user-id-'.$id;
    })->where(['id'=>'[0-9]+','name'=>'[A-Za-z]+']);
    Route::get('user/member-center',['as'=>'center',function (){
        return route('center');
    }]);
});*/
//Route::get('member/info','MemberController@info');
Route::get('member/{id?}',[
    'uses'=>'MemberController@info',
])->name('memberinfo')->where('id','[0-9]+');
Route::get('student',[
    'uses'=>'FoodController@test1',
])->name('student');
Route::get('insert',[
    'uses'=>'FoodController@insert',
])->name('insert');
Route::get('update',[
    'uses'=>'FoodController@update',
])->name('update');
Route::get('delete',[
    'uses'=>'FoodController@delete',
])->name('delete');
Route::get('query',[
    'uses'=>'FoodController@query',
])->name('query');
Route::get('orm',[
    'uses'=>'FoodController@orm',
])->name('orm');
Route::get('orm2',[
    'uses'=>'FoodController@orm2',
])->name('orm2');
Route::any('show',[
    'uses'=>'BladeController@show',
])->name('show');
/*
Route::middleware(['checkAge'])->group(function () {
    Route::post('checkAge',[
        'uses'=>'AgeController',
    ])->name('checkAge');
});*/
Route::post('checkAge',[
    'uses'=>'AgeController',
])->name('checkAge');
Route::resource('photos', 'PhotoController');

/*Route::group(['prefix' => 'admin'], function () {
    Route::get('/', 'Admin\IndexController@index');
});*/
Route::get('layout',function (){
    return view('layout');
})->name('layout');

Auth::routes();
/*Home*/
Route::group(['prefix' => 'home'], function () {
    Route::get('/', 'HomeController@index')->name('home');
    Route::post('/send', 'HomeController@send');
    Route::post('/getUserInfo', 'HomeController@getUserInfo');
    Route::post('/deleteDialogue', 'HomeController@deleteDialogue');
    Route::post('/getHistory', 'HomeController@getHistory');
    Route::post('/withdrawal', 'HomeController@withdrawal');
    Route::get('/chatList/{id}', 'HomeController@chatList')->where('id','[0-9]+');
    Route::get('/userList', 'HomeController@userList');
    Route::get('/createRoom', 'HomeController@createRoom');
    Route::get('/addUsers', 'HomeController@addUsers');
    Route::get('/reduceUsers', 'HomeController@reduceUsers');
    Route::post('/roomDelete', 'HomeController@roomDelete');
    Route::post('/roomSort', 'HomeController@roomSort');
    Route::post('/roomRename', 'HomeController@roomRename');
    Route::post('/getRoomMain', 'HomeController@getRoomMain');
    Route::post('/editNotice', 'HomeController@editNotice');
});
/*Log*/
Route::group(['prefix' => 'log'], function () {
    Route::get('/', 'LogController@index');
    Route::post('/delete', 'LogController@deleteLog');
});
Route::post('role/rightManage', 'RoleController@rightManage');
Route::resource('role','RoleController');

Route::resource('permission','PermissionController');

Route::post('user/rightStore', 'UserController@rightStore');
Route::post('user/changePermission', 'UserController@changePermission');
Route::post('user/rightEdit', 'UserController@rightEdit');
Route::resource('user','UserController');
/*Route::group(['prefix' => 'role'], function () {
    Route::get('/', 'RoleController@index')->name('role');
    Route::post('/store', 'RoleController@store');
    Route::post('/destroy/{id}', 'RoleController@destroy');
    Route::post('/show', 'RoleController@show');
    Route::post('/update', 'RoleController@update');
});*/
